'''
Author: @zhyy
Date: 2021-01-27 14:23:32
LastEditors: @zhyy
LastEditTime: 2021-01-31 16:04:27
'''

def to_one_json(data,chema):
    data_schema = chema() #用已继承ma.ModelSchema类的自定制类生成序列化类
    json_data= data_schema.dump(data) #生成可序列化对象
    return json_data

def to_many_json(data,chema):
    data_schema = chema(many=True) #用已继承ma.ModelSchema类的自定制类生成序列化类
    json_data= data_schema.dump(data) #生成可序列化对象
    return json_data